/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package py.com.peluq.model.entity;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Diego_M
 */
@Entity
@Table(name = "indemnizacion", catalog = "peludb", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Indemnizacion.findAll", query = "SELECT i FROM Indemnizacion i"),
    @NamedQuery(name = "Indemnizacion.findByIdindemnizacion", query = "SELECT i FROM Indemnizacion i WHERE i.indemnizacionPK.idindemnizacion = :idindemnizacion"),
    @NamedQuery(name = "Indemnizacion.findByCiEmp", query = "SELECT i FROM Indemnizacion i WHERE i.indemnizacionPK.ciEmp = :ciEmp"),
    @NamedQuery(name = "Indemnizacion.findByIdcargo", query = "SELECT i FROM Indemnizacion i WHERE i.indemnizacionPK.idcargo = :idcargo"),
    @NamedQuery(name = "Indemnizacion.findByIdcontrato", query = "SELECT i FROM Indemnizacion i WHERE i.indemnizacionPK.idcontrato = :idcontrato"),
    @NamedQuery(name = "Indemnizacion.findByMonto", query = "SELECT i FROM Indemnizacion i WHERE i.monto = :monto"),
    @NamedQuery(name = "Indemnizacion.findByObservacion", query = "SELECT i FROM Indemnizacion i WHERE i.observacion = :observacion")})
public class Indemnizacion implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected IndemnizacionPK indemnizacionPK;
    @Column(name = "monto")
    private Integer monto;
    @Column(name = "observacion")
    private Integer observacion;
    @JoinColumns({
        @JoinColumn(name = "idcontrato", referencedColumnName = "idcontrato", nullable = false, insertable = false, updatable = false),
        @JoinColumn(name = "idcargo", referencedColumnName = "idcargo", nullable = false, insertable = false, updatable = false),
        @JoinColumn(name = "ci_emp", referencedColumnName = "ci_emp", nullable = false, insertable = false, updatable = false)})
    @ManyToOne(optional = false)
    private Contrato contrato;

    public Indemnizacion() {
    }

    public Indemnizacion(IndemnizacionPK indemnizacionPK) {
        this.indemnizacionPK = indemnizacionPK;
    }

    public Indemnizacion(int idindemnizacion, int ciEmp, int idcargo, int idcontrato) {
        this.indemnizacionPK = new IndemnizacionPK(idindemnizacion, ciEmp, idcargo, idcontrato);
    }

    public IndemnizacionPK getIndemnizacionPK() {
        return indemnizacionPK;
    }

    public void setIndemnizacionPK(IndemnizacionPK indemnizacionPK) {
        this.indemnizacionPK = indemnizacionPK;
    }

    public Integer getMonto() {
        return monto;
    }

    public void setMonto(Integer monto) {
        this.monto = monto;
    }

    public Integer getObservacion() {
        return observacion;
    }

    public void setObservacion(Integer observacion) {
        this.observacion = observacion;
    }

    public Contrato getContrato() {
        return contrato;
    }

    public void setContrato(Contrato contrato) {
        this.contrato = contrato;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (indemnizacionPK != null ? indemnizacionPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Indemnizacion)) {
            return false;
        }
        Indemnizacion other = (Indemnizacion) object;
        if ((this.indemnizacionPK == null && other.indemnizacionPK != null) || (this.indemnizacionPK != null && !this.indemnizacionPK.equals(other.indemnizacionPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "py.com.peluq.model.entity.Indemnizacion[ indemnizacionPK=" + indemnizacionPK + " ]";
    }
    
}
